﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DomainModel
{
    /// <summary>
    /// Objet responsable du calcul de différents délais.
    /// </summary>
    internal class DelayCalculator
    {
        private IDelayCalculatingStrategy CurrentStrategy { get; set; }

        public void AssignCalculatingStrategy(IDelayCalculatingStrategy calculatingStrategy)
        {
            CurrentStrategy = calculatingStrategy;
        }

        public TimeSpan CalculateMaxRepairDelay()
        {
            if(CurrentStrategy == null) throw new InvalidOperationException("No calculating strategy defined");
            return CurrentStrategy.CalculateMaxDelay();
        }
    }
}
